#pragma once

#include "DLL.h"
#include "Types.h"
#include <MyViews/Tool.h>

namespace My {

void SnapToLine(const point<float> & start, point<float> & current,
	const point<double> & target, const point<double> & p, const point<double> & n, double h);

class TransformEditor;

class DLL_API TransformMove : public Manipulator
{
public:
	TransformMove(TransformEditor &, CPoint p);
public:
	virtual void Manipulate(UINT, CPoint);
	virtual void Apply(UINT, CPoint);
	virtual void PaintRect(CDC *, const CRect &);
private:
	TransformEditor &	m_Editor;
	point<float>		m_Start;
	rect<double>		m_Bounds;
	rect<double>		m_Margins;
	Affine				m_Old;
};

class DLL_API TransformRotate : public Manipulator
{
public:
	TransformRotate(TransformEditor &, CPoint p);
public:
	virtual void Manipulate(UINT, CPoint);
	virtual void Apply(UINT, CPoint);
	virtual void PaintRect(CDC *, const CRect &);
private:
	TransformEditor &	m_Editor;
	point<float>		m_Start;
	point<double>		m_Anchor;
	Affine				m_Old;
};

class DLL_API CornerPin : public Manipulator 
{
public:
	CornerPin(TransformEditor &, CPoint p, int index);
public:
	virtual void Manipulate(UINT, CPoint);
	virtual void Apply(UINT, CPoint);
	virtual void PaintRect(CDC *, const CRect &);
private:
	TransformEditor &	m_Editor;
	point<double>		m_BenchCorners[4];
	point<double>		m_ImageCorners[4];
	rect<double>		m_Margins;
	point<double>		m_Old;
	point<float>		m_Start;
	int					m_Index;
};

} // My